/*
 * Copyright 2008 Max Kugland
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.splink.library.queue {
	import org.splink.library.distributor.IDistributor;

	/**
	 * Interface for implementations which can be processed by an <code>IQ</code>.
	 * 
	 * An <code>IQable</code> implementation represents an asyncronous operation which can
	 * be added to an <code>IQ</code>.
	 * The <code>IQ</code> is able to execute the added <code>IQable</code>s sequentially. 
	 * Each <code>IQable</code> notifies it's listeners, about it's start (<code>QEvent.START</code>),
	 * about errors (<code>QEvent.ERROR</code>), completion (<code>QEvent.COMPLETE</code>) 
	 * and progress (<code>QEvent.PROGRESS</code>)
	 *
	 * Each <code>IQable</code> has an unique id. It can be started, stopped, reset and 
	 * finalized. 
	 * 
	 * @see org.splink.library.queue.QEvent	 * @see org.splink.library.queue.IQ 
	 * @author Max Kugland
	 */
	public interface IQable extends IDistributor {
		
		/**
		 * Starts the (asyncronous) processing and fires a <code>QEvent.START</code> event
		 * 
		 * @see org.splink.library.queue.QEvent
		 */
		function start() : void;
		
		/**
		 * Stops the (asyncronous) processing
		 */
		function stop() : void; 
		
		/**
		 * Resets the (asyncronous) processing into it's initial state
		 */
		function reset() : void;
		
		/**
		 * @return the id of the <code>IQable</code> implementation instance.
		 */
		function get id() : String;
	}
}
